﻿package com.vigmonk.utils
{
	import flash.display.DisplayObjectContainer;
	import flash.display.LoaderInfo;
	import flash.system.Capabilities;	

	/**
	 * 
	 * GetParam.as
	 * @author VIGMONK
	 * 
	 */
	 
	/**
	 * 
	 * import com.vigmonk.utils.GetParam;
	 * 
	 * var getParam:GetParam = new GetParam();
	 * getParam.init(this);
	 * 
	 * trace(getParam.flvUrl);
	 * 
	 */

	public class Params
	{

		private static var paramObj:Object;

		public function Params():void
		{
		}

		public static function init(_dispObj:DisplayObjectContainer):void
		{
			paramObj = new Object();
			
			var type:String = Capabilities.playerType;
			
			if(type=='StandAlone' || type=='External') {
				// 오프라인 일때
				paramObj.flvUrlStr = 'flv.flv';
				paramObj.imgUrlStr = 'img.jpg';
			}else {
				// 온라인 일때				
				var obj:Object = LoaderInfo(_dispObj.root.loaderInfo).parameters;
				for (var prop in obj) {
					paramObj[prop] = String(obj[prop]);
				}
			}		
			/*
			for (var prop2 in paramObj) {
				trace(prop2+' = '+paramObj[prop2]);
			}*/
		}

		public static function get flvUrl():String
		{
			return paramObj.flvUrlStr;
		}

		public static function get imgUrl():String
		{
			return paramObj.imgUrlStr;
		}
	}	
}